package org.edu.model;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
/**<h2>用户信息表</h2>
 * <p>该表详细配置了用户与用户信息one-to-one的关系</P>
 * 
 * @author lenove-x
 * @version 1.1
 * @see User
 */
@Entity
@Table(name = "T_Userdetailed")
public class UserDetailed {
	
	private String account; 
	private String aliases;//别名
	private String sex;//性别
	private Date birthday; //生日
	private String email;// 邮箱
	
	private User user;
	
	@Id
	@GeneratedValue(generator="pkGenerator")
	@GenericGenerator(name="pkGenerator",
	            strategy="foreign",
	            parameters={@Parameter(name="property",value="user")})
	public String getAccount() {
		return account;
	}
	public void setAccount(String account) {
		this.account = account;
	}
	public String getAliases() {
		return aliases;
	}
	public void setAliases(String aliases) {
		this.aliases = aliases;
	}
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	@OneToOne(cascade=CascadeType.ALL)
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	@Override
	public String toString() {
		StringBuffer sb= new StringBuffer();
		sb.append(aliases).append("->").append(email).append("->").append(sex).append("->").append(birthday);
		return sb.toString();
	}
	
	

}
